package com.xzc.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 熊志聪
 * @Classname ExportColumnEnum
 * @Description 打印到xls中的字段
 * @Date 2021/8/3 22:37
 */
@AllArgsConstructor
@Getter
public enum ExportColumnEnums {
    /**
     * type:类型(该打印表头信息属于哪个)
     * 所属一级部门	所属二级部门	姓名	项目名称	项目编码	投入工时(小时)
     *  月度总工时
     */
    ONE_DEPT("oneDeptName","所属一级部门",0),
    TWO_DEPT("twoDeptName","所属二级部门",0),
    STAFF_NAME("staffName","姓名",0),
    PROJECT_NAME("projectName","项目名称",0),
    PROJECT_CODE("projectCode","项目编码",0),
    WORK_TIME("workTime","投入工时(小时)",0),
    TOTAL_MONTHLY_WORK_TIME("totalMonthlyWorkTime","月度总工时",0),
    ;
    private final String columnName;
    private final String alias;
    private final Integer type;

    /**
     * 获取范本的表头
     *
     * @return
     */
    public static List<ExportColumnEnums> getColumns(Integer type) {
        List<ExportColumnEnums> cols = new ArrayList<>();
        for (ExportColumnEnums columnEnum : values()) {
            if (columnEnum.type.equals(type)) {
                cols.add(columnEnum);
            }
        }
        return cols;
    }
    //
    public static List<String> getAlias(Integer type) {
        List<String> alias = new ArrayList<>();
        for (ExportColumnEnums columnEnum : values()) {
            if (columnEnum.type.equals(type)) {
                alias.add(columnEnum.getAlias());
            }
        }
        return alias;
    }

}
